# import requests
# from pprint import pprint
#
# # 打印HTTP响应消息的函数
# def printResponse(response):
#     print('\n\n-------- HTTP response * begin -------')
#     # print(response.status_code)
#
#     # for k, v in response.headers.items():
#     #     print(f'{k}: {v}')
#
#     # print('')
#
#     print(response.content.decode('utf8'))
#     print('-------- HTTP response * end -------\n\n')
#
#
# response = requests.post("http://******************/api/v1/auth/userToken",              #1
#                         json={"userAccount":"******************","password":"******************"}
#                          )
# auth_token=str(response.json()["data"]["token"])
# printResponse(response)
# print(auth_token)
#
#
#
# urlpara = {         #参数为可选项
#     'locationId':349
# }
# response = requests.post("http://******************/api/v1/dataManagement/getSubAppList",      #2.1
#                          headers={
#                              "auth-token": auth_token
#                          }
#                          )
# printResponse(response)
# print(2.1)
#
#
# urlpara = {
#     'appName':'AFC%2CPSD%2CBAS'
# }
# response = requests.post("http://******************/api/v1/dataManagement/getPointByAppName",      #2.2
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(2.2)
#
#
# urlpara = {
#     'deviceName':'AFC001%2CAFC002%2CPA001%2CZM001'
# }
# response = requests.post("http://******************/api/v1/dataManagement/getStatusByDeviceName",      #2.3
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(2.3)
#
#
# urlpara = {
#     'appName':'BAS%2CAFC'
# }
# response = requests.post("http://******************/api/v1/dataManagement/getStatusByAppName",     #2.4
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(2.4)
#
#
# urlpara = {                 #   告诉我设备名不能为空？？？？？？？？？？
#     'deviceName ':'AFC001%2CAFC002%2CPA001%2CZM001'
# }
# response = requests.post("http://******************/api/v1/dataManagement/getPointByDeviceName",     #2.5
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(2.5)
#
#
#
# response = requests.post("http://******************/api/v1/dataManagement/getSubAppList",     #2.6
#                          headers={
#                              "auth-token": auth_token
#                          }
#                          )
# printResponse(response)
# print(2.6)
#
#
#
# urlpara = {
#     'pointName':'ZGZ.BAS.ZM.CONTROL.ddocb01_0'
# }
# response = requests.post("http://******************/services/Message/ESCControl",     #3.1
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(3.1)
#
#
#
#
# urlpara = {
#     'pointName':'ZGZ.BAS.ZM.CONTROL.ddocb02_0'
# }
# response = requests.post("http://******************/services/Message/RSDControl",     #3.2
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(3.2)
#
#
#
#
# urlpara = {
#     'pointName':'ZGZ.BAS.ZM.CONTROL.ddocb03_0'
# }
# response = requests.post("http://******************/services/Message/AFCControl",     #3.3
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(3.3)
#
#
#
#
# urlpara = {
#     'pointName':'ZGZ.BAS.ZM.CONTROL.ddocb04_1'
# }
# response = requests.post("http://******************/services/Message/PAControl",     #3.4
#                          headers={
#                              "auth-token": auth_token
#                          },
#                          params=urlpara
#                          )
# printResponse(response)
# print(3.4)
#
#
#
#
#
# urlpara = {             #参数为可选项
#     'actTimeEnd':'','actTimeStart':'','alarmTimeEnd':'','alarmTimeStart':'','isAckTime':'','isAlarmTime':'','likeName':'','severity':'','sortParam':'',
#     'sortType':'','state':'','subAppId':'','subSystem':''
# }
# response = requests.post("http://******************/services/Message/alarms",     #4.1
#                          headers={
#                              "auth-token": auth_token
#                          }
#                          )
# printResponse(response)
# print(4.1)
#
#
#
#
# urlpara = {
#     'pointKey':'98609701',
#     'machineName':'mc001',
#     'userName':'user001'
# }
# response = requests.post("http://******************/services/Message/alarm",     #4.2
#                          headers={
#                              "auth-token": auth_token
#                          }
#                          )
# printResponse(response)
# print(4.2)